package com.zhengze;

import java.util.HashMap;
import java.util.Map;

public class Demo13 {
    public static void main(String[] args) {
        String str = "Hello, ${name}, Learning ${language}";

        Map<String, String> map = new HashMap<>();
        map.put("name", "Jack");
        map.put("language", "Java");

        for (String key : map.keySet()) {
            str = str.replaceAll("\\$\\{" + key + "\\}", map.get(key));
        }
        
        System.out.println(str);
    }
}